﻿using System;
using System.Collections.Generic;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Auditing;

namespace AbpProjectTemplate.System
{


    //[AutoMap(typeof(AuditLog))]
    public class AuditLogDto : ExtensibleEntityDto
    {
        /// <summary>
        /// 应用名称
        /// </summary>
        public virtual string ApplicationName { get; set; }
        /// <summary>
        /// 操作者ID
        /// </summary>
        public virtual Guid? UserId { get; protected set; }
        /// <summary>
        /// 操作者
        /// </summary>
        public virtual string UserName { get; protected set; }
        /// <summary>
        /// 开始执行时间
        /// </summary>
        public virtual DateTime ExecutionTime { get; protected set; }
        /// <summary>
        /// 执行时间
        /// </summary>
        public virtual int ExecutionDuration { get; protected set; }
        /// <summary>
        /// 客户端IP
        /// </summary>
        public virtual string ClientIpAddress { get; protected set; }
        /// <summary>
        /// 浏览器信息
        /// </summary>
        public virtual string BrowserInfo { get; protected set; }
        /// <summary>
        /// http方法
        /// </summary>
        public virtual string HttpMethod { get; protected set; }
        /// <summary>
        /// 执行URL
        /// </summary>
        public virtual string Url { get; protected set; }
        /// <summary>
        /// 异常
        /// </summary>
        public virtual string Exceptions { get; protected set; }
        /// <summary>
        /// 备注说明
        /// </summary>
        public virtual string Comments { get; protected set; }
        /// <summary>
        /// http状态
        /// </summary>
        public virtual int? HttpStatusCode { get; protected set; }

        public virtual ICollection<EntityChangeDto> EntityChanges { get; protected set; }

        public virtual ICollection<AuditLogActionDto> Actions { get; protected set; }
    }

    //[AutoMap(typeof(AuditLogAction))]
    public class AuditLogActionDto : ExtensibleEntityDto
    {
        /// <summary>
        /// 服务名
        /// </summary>
        public virtual string ServiceName { get; protected set; }
        /// <summary>
        /// 方法名
        /// </summary>
        public virtual string MethodName { get; protected set; }
        /// <summary>
        /// 参数
        /// </summary>
        public virtual string Parameters { get; protected set; }
        /// <summary>
        /// 开始时间
        /// </summary>
        public virtual DateTime ExecutionTime { get; protected set; }
        /// <summary>
        /// 执行时间
        /// </summary>
        public virtual int ExecutionDuration { get; protected set; }
    }

    //[AutoMap(typeof(EntityChange))]
    public class EntityChangeDto : ExtensibleEntityDto
    {
        /// <summary>
        /// 修改时间
        /// </summary>
        public virtual DateTime ChangeTime { get; protected set; }
        /// <summary>
        /// 变更类型
        /// </summary>
        public virtual EntityChangeType ChangeType { get; protected set; }
        /// <summary>
        /// 数据ID
        /// </summary>
        public virtual string EntityId { get; protected set; }
        /// <summary>
        /// 数据类型
        /// </summary>
        public virtual string EntityTypeFullName { get; protected set; }
        /// <summary>
        /// 修改的字段集合
        /// </summary>
        public virtual ICollection<EntityPropertyChangeDto> PropertyChanges { get; protected set; }
    }

    //[AutoMap(typeof(EntityPropertyChange))]
    public class EntityPropertyChangeDto : ExtensibleEntityDto
    {
        /// <summary>
        /// 修改字段
        /// </summary>
        public virtual string PropertyName { get; protected set; }
        /// <summary>
        /// 原始值
        /// </summary>
        public virtual string OriginalValue { get; protected set; }
        /// <summary>
        /// 修改后的值
        /// </summary>
        public virtual string NewValue { get; protected set; }
    }
}
